

package com.tool.tcpimg;

import java.awt.Dimension;
import java.awt.Graphics;

import org.come.Jpanel.GameJpanel;
import org.come.bean.ImgZoom;
import org.come.until.*;


public class TipBox {

	private RichLabel label;
	private int time;
	private ImgZoom imgZoom;
	private int px;
	private int width;
	private int height;

	public TipBox(String text)
	{
		Music.addyinxiao("获得提示.mp3");

		label = new RichLabel(text, UIUtils.TEXT_FONT2);
		label.setLocation(16, 12);
		Dimension d = label.computeSize(640);
		label.setSize(d);
		width = d.width - 12;
		height = d.height + 25;
		imgZoom = CutButtonImage.cuts("inkImg/old/1/XXBJT.png", 6, 6, true);
		int w = 0;
		if(width>320) {
			w = ScrenceUntil.Screen_x / 2;
			imgZoom.setMiddlew(width+25);
		}else {
			w = ScrenceUntil.Screen_x / 2 -((320-width)/2);
			imgZoom.setMiddlew(320);
		}
		imgZoom.setMiddleh(d.height+15);
		time = Util.TIME_CHAT2;
		px = w - d.width / 2;


//		label = new RichLabel(text, UIUtils.TEXT_FONT2);
//		label.setLocation(6, 6);
//		Dimension d = label.computeSize(640);
//		label.setSize(d);
//		width = d.width + 12;
//		height = d.height + 12;
//		imgZoom = CutButtonImage.cuts("inkImg/hongmu/2/88_png.xy2uiimg.png", 6, 6, true);
//		imgZoom.setMiddlew(d.width);
//		imgZoom.setMiddleh(d.height);
//		time = Util.TIME_CHAT2;
//		px = ScrenceUntil.Screen_x / 2 - d.width / 2;
	}

	public void paint(Graphics g) {
		g.translate(px, 0);
		imgZoom.draw(g);
		g.translate(label.getX(), label.getY());
		label.paint(g);
		g.translate(-px - label.getX(), -label.getY());
	}

	public RichLabel getLabel()
	{
		return label;
	}

	public void setLabel(RichLabel label)
	{
		this.label = label;
	}

	public boolean IsTime()
	{
		return time-- > 0;
	}

	public ImgZoom getImgZoom()
	{
		return imgZoom;
	}

	public void setImgZoom(ImgZoom imgZoom)
	{
		this.imgZoom = imgZoom;
	}

	public int getPx()
	{
		return px;
	}

	public void setPx(int px)
	{
		this.px = px;
	}

	public int getWidth()
	{
		return width;
	}

	public void setWidth(int width)
	{
		this.width = width;
	}

	public int getHeight()
	{
		return height;
	}

	public void setHeight(int height)
	{
		this.height = height;
	}
}
